package calculadora;

import java.util.Scanner;

public class OperacionesVarias {

	Scanner sc = new Scanner(System.in); 
	private static double iNumA = 0;
	private static double iNumB = 0;
	private static char cOpe;
	private static double iOperation;
	private static boolean bSalir;

	public void opeVarias()throws Exception{

		System.out.println("Digite el primer Valor");
		iNumA = sc.nextDouble();

		do{

			System.out.println("Digite la operacion que va a realizar");
			cOpe = (char)System.in.read();
			System.in.read();
			System.out.println("Digite el siguiente Valor");
			iNumB = sc.nextDouble();

			switch(cOpe){

			case '+':{

				iOperation = iNumA + iNumB;
				System.out.println(iNumA+" "+cOpe+" "+iNumB+" = "+iOperation);
				break;

			}

			case '-':{

				iOperation = iNumA - iNumB;
				System.out.println(iNumA+" "+cOpe+" "+iNumB+" = "+iOperation);
				break;

			}

			case '*':{

				iOperation = iNumA * iNumB;
				System.out.println(iNumA+" "+cOpe+" "+iNumB+" = "+iOperation);
				break;	

			}

			case '/':{

				iOperation = iNumA / iNumB;
				System.out.println(iNumA+" "+cOpe+" "+iNumB+" = "+iOperation);
				break;		

			}

			default:{

				System.out.println("Operacion seleccionada no es Valida");
				bSalir = true;

			}
			}//End Switch

			iNumA = iOperation;

		}while (bSalir != true);

		System.out.println("Saliendo del Sistema");




	}


}
